let is_evening = true;
let my_first_initial = 'C';
if my_first_initial.is_alphabetic() {
println!("Alphabetical!");
} else if my_first_initial.is_numeric() {
println!("Numerical!");
} else {
println!("Neither alphabetic nor numeric!");
}
let a: [i32; 5] = [1, 2, 3, 4, 5];
let b: = [3; 10]; // [3,3,3,3,3,3,3,3,3,3]
String slices
fn main() {
let s = String::from("hello world");
let hello = &s[0..5];
let world = &s[6..11];
}
fn main() {
let tup = (500, 6.4, 1);
let (x, y, z) = tup;
println!("The value of y is: {}", y);
}
이런식으로 꺼내 먹어요.
fn main() {
let x: (i32, f64, u8) = (500, 6.4, 1);
let five_hundred = x.0;
let six_point_four = x.1;
let one = x.2;
}